Conventional virtual machines are designed to execute computer programs in a platform-independent environment. A virtual machine may utilize two or more execution threads (e.g., a main thread and one or more worker threads) to execute a computer program. A virtual machine may provide a protocol to post a message including a payload between two execution threads. The message payload may comprise an object, however, in the case of many virtual machines (e.g., a JavaScript Runtime Environment), the payload object is not permitted to include a function within its definition. Payloads passed between execution threads are therefore limited to “pure” objects (e.g., JavaScript Object Notation objects).
In order to post a function-containing object between execution threads, a developer is required to manually generate a serialized form of the object which omits any functions of the object. Manually generating the serialized form is onerous, error-prone and robs the subsequently-transferred object of its functionality at the receiving execution thread.